﻿using SharpObjects.Configuration.ConfigurationProviders;
using SharpObjects.Interfaces;

namespace SharpObjects.Configuration_Test
{
    public class MyData : IXmlInitializable 
    {
        public string Id { get; set; }
        public string Message { get; set; }

        public MyData()
        {
            
        }

        public override string ToString()
        {
            return string.Format("{0}: {1}", this.Id, this.Message);
        }

        #region IXmlInitializable Members

        public void Initialize(System.Xml.XmlElement initializationElement)
        {
            XmlConfigurationProvider init = new XmlConfigurationProvider(initializationElement);

            this.Id = init.GetString("@id");
            this.Message = init.GetString("message", string.Empty);

            this.IsInitialized = true;
        }

        public bool IsInitialized { get; set; }


        #endregion
    }
}
